package com.fm.base.database.domain;

import com.fm.base.json.JsonUtils;

import java.util.Map;
import java.util.TreeMap;

/**
 * @author leo.li
 */
public class DBSortedDocument extends TreeMap<String, Object> implements DBDocument {
    public DBSortedDocument() {
        super();
    }

    public DBSortedDocument(String key, Object value) {
        super();
        put(key, value);
    }

    public DBSortedDocument(Map<String, Object> map) {
        super();
        putAll(map);
    }

    @Override
    public DBSortedDocument append(String key, Object value) {
        put(key, value);
        return this;
    }

    @Override
    public String toString() {
        return JsonUtils.toFormatJson(this);
    }

    @Override
    public DBSortedDocument clone() {
        return (DBSortedDocument) super.clone();
    }
}